<?php

namespace App\Http\Controllers\Game\Setting\Config;

use App\Http\Controllers\Controller;
use App\Http\Requests\Game\Setting\Config\Elementary\UpdateRequest;
use App\Http\Resources\Common\DataResource;
use App\Services\Game\Setting\Config\CommonService as ConfigService;

class ElementaryController extends Controller
{

    /**
     * 获取配置
     */
    public function getConfig($gameCode)
    {
        $config = ConfigService::make()->getConfig($gameCode);

        return new DataResource($config);
    }

    /**
     * 更新配置
     */
    public function update($gameCode, UpdateRequest $request)
    {
        $config = ConfigService::make()->update($gameCode, $request);

        return new DataResource($config);
    }

    /**
     * 获取配置【平台】
     */
    public function getConfigPlat($gameCode, $platCode)
    {
        $config = ConfigService::make()->getConfigPlat($gameCode, $platCode);

        return new DataResource($config);
    }

    /**
     * 更新配置【平台】
     */
    public function updatePlat($gameCode, $platCode, UpdateRequest $request)
    {
        $config = ConfigService::make()->updatePlat($gameCode, $platCode, $request);

        return new DataResource($config);
    }
}
